﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class  ConsoleApp1
{
    static void Main()
    {
        int[] numbers = { 3, 7, 2, 8, 1, 9, 4, 6, 5 };

        int max = numbers[0];
        int min = numbers[0];
        int sum = 0;

        foreach (int num in numbers)
        {
            if (num > max)
                max = num;

            if (num < min)
                min = num;

            sum += num;
        }

        double average = (double)sum / numbers.Length;

        Console.WriteLine("最大值: " + max);
        Console.WriteLine("最小值: " + min);
        Console.WriteLine("平均值: " + average);
        Console.WriteLine("所有数组元素的和: " + sum);
    }
}
